<template>
    <div class="front bj">
        <el-scrollbar style="height: 100%;">
            <el-form :model="formData" label-width="120px" label-position="left" v-loading="loading[0]" element-loading-text="拼命加载中..." element-loading-spinner="el-icon-loading" element-loading-background="#fff">
                <el-form-item label="名称：">
                    <el-input v-model.trim="formData.name" readonly></el-input>
                </el-form-item>
                <el-form-item label="助记码：">
                    <el-input v-model.trim="formData.mnemonicCode" readonly></el-input>
                </el-form-item>
                <el-form-item label="简称：">
                    <el-input v-model.trim="formData.abbreviation" readonly></el-input>
                </el-form-item>
                <el-form-item label="客户地址：">
                    <el-input v-model.trim="formData.address" readonly></el-input>
                </el-form-item>
                <el-form-item label="区域：">
                    <el-input v-model.trim="formData.locationName" readonly></el-input>
                </el-form-item>
                <el-form-item label="行业：">
                    <el-input v-model.trim="formData.tradeName" readonly></el-input>
                </el-form-item>
                <el-form-item label="联系人：">
                    <el-input v-model.trim="formData.linkman" readonly></el-input>
                </el-form-item>
                <el-form-item label="电话：">
                    <el-input v-model.trim="formData.tel" readonly></el-input>
                </el-form-item>
                <el-form-item label="传真：">
                    <el-input v-model.trim="formData.fax" readonly></el-input>
                </el-form-item>
                <el-form-item label="客户大类：">
                    <el-input v-model.trim="formData.clientCategoryName" readonly></el-input>
                </el-form-item>
                <el-form-item label="客户价值分类：">
                    <el-input v-model.trim="formData.customerValueCategoryName" readonly></el-input>
                </el-form-item>
                <el-form-item label="客户产品分类：">
                    <el-input v-model.trim="formData.customerProductCategoryName" readonly></el-input>
                </el-form-item>
                <el-form-item label="开户名1">
                    <el-input v-model.trim="formData.accountNameOne" readonly></el-input>
                </el-form-item>
                <el-form-item label="开户银行1">
                    <el-input v-model.trim="formData.depositBankOne" readonly></el-input>
                </el-form-item>
                <el-form-item label="银行账户1">
                    <el-input v-model.trim="formData.bankAccountOne" readonly></el-input>
                </el-form-item>
                <el-form-item label="开户名2">
                    <el-input v-model.trim="formData.accountNameTwo" readonly></el-input>
                </el-form-item>
                <el-form-item label="开户银行2">
                    <el-input v-model.trim="formData.depositBankTwo" readonly></el-input>
                </el-form-item>
                <el-form-item label="银行账户2">
                    <el-input v-model.trim="formData.bankAccountTwo" readonly></el-input>
                </el-form-item>
                <el-form-item label="开户名3">
                    <el-input v-model.trim="formData.accountNameThree" readonly></el-input>
                </el-form-item>
                <el-form-item label="开户银行3">
                    <el-input v-model.trim="formData.depositBankThree" readonly></el-input>
                </el-form-item>
                <el-form-item label="银行账户3">
                    <el-input v-model.trim="formData.bankAccountThree" readonly></el-input>
                </el-form-item>
                <el-form-item label="税务登记号：">
                    <el-input v-model.trim="formData.taxRedistrationNumber" readonly></el-input>
                </el-form-item>
                <el-form-item label="税率：">
                    <el-input v-model.trim="formData.vatRates" readonly></el-input>
                </el-form-item>
                <el-form-item label="所在国家：">
                    <el-input v-model.trim="formData.locationCountry" readonly></el-input>
                </el-form-item>
                <el-form-item label="所在省份：">
                    <el-input v-model.trim="formData.locationProvince" readonly></el-input>
                </el-form-item>
                <el-form-item label="所在城市：">
                    <el-input v-model.trim="formData.locationCity" readonly></el-input>
                </el-form-item>
                <el-form-item label="公司主页：">
                    <el-input v-model.trim="formData.homepage" readonly></el-input>
                </el-form-item>
                <el-form-item label="法人代表：">
                    <el-input v-model.trim="formData.legalPersonRepresentative" readonly></el-input>
                </el-form-item>
                <el-form-item label="销售方式：">
                    <el-input v-model.trim="formData.saleMethodName" readonly></el-input>
                </el-form-item>
                <el-form-item label="分管部门：">
                    <el-input v-model.trim="formData.chargeDepartmentName" readonly></el-input>
                </el-form-item>
                <el-form-item label="专营业务员：">
                    <el-input v-model.trim="formData.franchiseClerkName" readonly></el-input>
                </el-form-item>
                <el-form-item label="信用额度：">
                    <el-input v-model.trim="formData.creditAmount" readonly></el-input>
                </el-form-item>
                <el-form-item label="结算期限：">
                    <el-input v-model.trim="formData.settlementPeriodName" readonly></el-input>
                </el-form-item>
                <el-form-item label="备注：">
                    <el-input v-model.trim="formData.remark" readonly></el-input>
                </el-form-item>
                <el-form-item style="margin-bottom: 10px !important;">
                    <el-button size="small" type="danger" @click="close">关闭</el-button>
                </el-form-item>
            </el-form>
        </el-scrollbar>
    </div>
</template>
<script>
export default {
	data() {
		return {
			formData: {},
            loading: this.$store.state.customerStore.loading
		}
	},
	computed: {
		rowId() {
			return this.$store.state.customerStore.rowId;
		}
	},
	methods: {
		getData() {
            this.$store.commit('customerStore/updateLoading', true);
			this.$http.get('client/findSingleClientById?id=' + this.rowId).then(res => {
				if(res.data.code == 20001) {
                    this.$store.commit('customerStore/updateLoading', false);
					if(res.data.data) {
						this.formData = res.data.data;
					}
				} else {
                    this.$store.commit('customerStore/updateLoading', false);
                }
			});
		},
		close() {
			let index = parent.layer.getFrameIndex(window.name);    //先得到当前iframe层的索引
            parent.layer.close(index);
		}
	},
	mounted() {
		this.getData();
	}
}
</script>